<?php
class SameCateArticleWidget extends BaseWidget {
	public function get_data(){
		//当前的分类
		global $cate;
		if(empty($cate))return array();
		
		if(isset($this->config['limit'])){
			$limit = $this->config['limit'];
		}else{
			$limit = 5;
		}
		
		$mod = new ArticleModel();
		$articles = $mod->find(array('site_id'=>SITE_ID, 'cate'=>$cate['_id']), 'alias,title,summary,tags,author,time', 0, $limit);
		foreach ($articles as &$article){
			init_article_url($article, $cate['path']);
			$article['title'] = cut_str($article['title'], 15);
		}
		return array(
			'cate' => $cate,
			'articles' => $articles,
		);
	}
}

?>